<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="textmsgs" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 地址 </span>
      </div>
      <el-table :data="textmsgs">
        <el-table-column label="操作<!--3-->" prop="" width="65">
          <template slot-scope="scope">
            <el-link @click="appendRow(textmsgs,scope)" type='primary'><i class='el-icon-plus' title='增加行' /></el-link>
            <el-link @click="delRow(textmsgs,scope)" type='primary'><i class='el-icon-minus' title='删除行' /></el-link>
          </template>
        </el-table-column>
        <el-table-column label="地址类型" prop="">
          <template slot-scope="scope">
            <el-select style='width:100%' v-model="scope.row.address_type">
              <el-option label="注册地" value="注册地" />
              <el-option label="生产地" value="生产地" />
              <el-option label="研发地" value="研发地" />
              <el-option label="销售地" value="销售地" />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="国家" prop="">
          <template slot-scope="scope">
            <el-select style='width:100%' v-model="scope.row.address_nation">
              <el-option label="中国" value="中国" />
              <el-option label="美国" value="美国" />
              <el-option label="英国" value="英国" />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="省" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.address_province" />
          </template>
        </el-table-column>
        <el-table-column label="市" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.address_city" />
          </template>
        </el-table-column>
        <el-table-column label="邮政编码" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.address_postcode" />
          </template>
        </el-table-column>
        <el-table-column label="地址" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.address_info" />
          </template>
        </el-table-column>
        <el-table-column label="纬度" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.address_latitude" />
          </template>
        </el-table-column>
        <el-table-column label="经度" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.address_longitude" />
          </template>
        </el-table-column>
      </el-table>
      <el-button @click="devSupplierAdreAddSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/mes/produce/SupplierInfo?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'DevSupplierAdreAdd',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        textmsgs: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/produce/DevSupplier/devSupplierAdreAdd?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      devSupplierAdreAddSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/produce/DevSupplier/devSupplierAdreAddSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/mes/produce/SupplierInfo/supplierInfo?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
